package com.yuteng.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yuteng.user.entity.VideoUser;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.yuteng.user.mapper.VideoUserMapper;
import com.yuteng.user.service.VideoUserService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 系统用户表（存放所有的管理员和用户信息）服务接口实现
 *
 * @author 余腾
 * @since 2021-10-27 16:25:26
 * @description 用户喜欢的视频的一些信息
 */
@Slf4j
@RequiredArgsConstructor
@Service
public class VideoUserServiceImpl implements VideoUserService {
    private final VideoUserMapper videoUserMapper;
    public VideoUser getByUsername(String username){
        QueryWrapper queryWrapper=new QueryWrapper();
        queryWrapper.eq("name",username);
        VideoUser videoUser = videoUserMapper.selectOne(queryWrapper);
        return videoUser;
    }

    public List deleteUser(Long id) {
        videoUserMapper.deleteById(id);
        return null;
    }

    public List updateUser(VideoUser videoUser) {
        videoUserMapper.updateById(videoUser);
        return null;
    }

    public List add(VideoUser videoUser) {
        videoUserMapper.insert(videoUser);
        return null;
    }
}